﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace JQueryControlToolkit
{
    public interface JSArray : IEnumerable<JSObject>, JSObject
    {
    }

    public class JSList : List<JSObject>, JSArray
    {
        public JSList()
        {

        }

        public JSList(IEnumerable<JSObject> body)
            : base(body)
        {

        }

        #region JSObject Members

        public string ToScript()
        {
            return Extensions.ToScript(this);
        }

        public void ToScript(TextWriter toScript)
        {
            bool isFirst = true;
            foreach (JSObject item in this)
            {
                if (isFirst)
                    isFirst = false;
                else
                    toScript.Write(", ");
                item.ToScript(toScript);
            }
        }

        #endregion
    }
}
